package com.github.cyf.controller;

import com.github.cyf.common.model.Rs;
import com.github.cyf.entity.Teacher;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenyifan
 * @create 2024-05-07 21:56
 */
@RestController
@RequestMapping("/cascade")
@Api(tags = "2、级联校验")
@ApiSupport(order = 2)
public class CascadeController {

    /*
        {
          "studentList": [
            {
              "studentName": "12",
              "studentName": "13",
              "studentName": ""
            }
          ],
          "teacherName": "22"
        }
     */
    @PostMapping("/teacher")
    public Rs teacher(@RequestBody @Validated Teacher teacher) {
        return Rs.ok("校验成功").setData(teacher);
    }
}
